package com.sckj.springboot.dao;

import com.sckj.springboot.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    User getUserByName(String name);

    List<User> getUserList();

    @Select("select * from user where id = #{id}")
    @Results({
            @Result(property = "username", column = "user_name"),
            @Result(property = "password", column = "password")
    })
    User getUser(Integer id);

    @Select("select * from user where id = #{id} and user_name=#{name}")
    User getUserByIdAndName(@Param("id") Integer id, @Param("name") String username);

    @Select("select * from user")
    List<User> getAll();
}
